package com.weihui.jxc.service.impl;

import java.util.List;

import com.weihui.jxc.dao.OperatorDao;
import com.weihui.jxc.model.Operator;
import com.weihui.jxc.service.OperatorService;
/**
 * 操作者业务实现类
 * @author xiaowei
 *
 */
public class OperatorServiceImpl implements OperatorService {
	private OperatorDao operatorDao = null;
	
	/**
	 * 查询用户名和密码是否正确
	 * @param operator：内部需要封装username和password
	 * @return：true-正确，false-不正确
	 */
	@Override
	public boolean loginCheck(Operator operator) {
		operatorDao = new OperatorDao();
		return operatorDao.loginCheck(operator);
	}
	
	/**
	 * 通过登录名查询操作者信息
	 * @param username：登录名
	 * @return：返回的就是操作者对象
	 */
    @Override
    public Operator getOperator(String username) {
    	operatorDao = new OperatorDao();
    	return operatorDao.getOperator(username);
    }

	@Override
	public boolean saveOperator(Operator o) {
		operatorDao = new OperatorDao();
		return operatorDao.save(o);
	}

	@Override
	public List<Operator> queryAll(Operator o) {
		operatorDao = new OperatorDao();
		return operatorDao.query(o);
	}

	@Override
	public boolean updateOperator(Operator o) {
		operatorDao = new OperatorDao();
		return operatorDao.update(o);
	}

	@Override
	public boolean deleteOperator(String username) {
		operatorDao = new OperatorDao();
		return operatorDao.delete(username);
	}
}